package cn.wolfcode.luowowo.controller;

import cn.wolfcode.luowowo.domain.StrategyComment;
import cn.wolfcode.luowowo.domain.UserInfo;
import cn.wolfcode.luowowo.interceptor.ResolverUserInfo;
import cn.wolfcode.luowowo.query.StrategyCommentQuery;
import cn.wolfcode.luowowo.redis.srevice.IUserRedisSrevice;
import cn.wolfcode.luowowo.service.IRegionService;
import cn.wolfcode.luowowo.service.IStrategyCatalogService;
import cn.wolfcode.luowowo.service.IStrategyCommentService;
import cn.wolfcode.luowowo.service.IUserInfoService;
import cn.wolfcode.luowowo.service.impl.StrategyServiceImpl;
import cn.wolfcode.luowowo.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("strategycomment")
public class StrategyCommentController {
    @Autowired
    private IRegionService regionService;
    @Autowired
    private IStrategyCatalogService strategyCatalogService;
    //攻略分类
    @Autowired
    private StrategyServiceImpl strategyService;
    /*游记业务层对象*/
    @Autowired
    private IStrategyCommentService strategyCommentervice;
    
    @Autowired
    private IUserRedisSrevice userRedisSrevice;
    @Autowired
    private IUserInfoService userInfoService;
    /**
     * 根据目的地的id查询目的地关联的游记
     * @param qo 目的地id
     * @return  返回的是分页后的游记数据
     */
    @GetMapping("/comments")
    public Object query(StrategyCommentQuery qo, @ResolverUserInfo UserInfo userInfo){
        Page<StrategyComment> query = strategyCommentervice.query(qo);
        return JsonResult.success(query);
    }
    
    @GetMapping("/info")
    public Object info(@ResolverUserInfo UserInfo userInfo){
        return JsonResult.success(userInfo);
    }
    

    

    
  
    
   
    
  
}
